-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(material/core): prevent updates to v17 if project uses legacy components #28024
Conversation
52f1362
to
b238105
Compare
|
||
if (packageJson !== null && packageJson['dependencies']) { | ||
packageJson['dependencies']['@angular/material'] = '^16.2.0'; | ||
tree.overwrite('package.json', JSON.stringify(packageJson, null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we have a utility for adding dependencies to the package.json
(in at least two places!), however my understanding is that we can't put it into a common spot, because the other places are ng add
schematics and they might not be able to import other packages yet (I may be wrong). This operation is pretty basic so we should be fine.
* from running if the project is using legacy components. | ||
* @param onSuccess Rule to run if there are no legacy imports. | ||
*/ | ||
export function legacyImportsError(onSuccess: Rule): Rule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't go through the DevkitMigration
for this schematic, because it isn't a standard migration schematic and the operations in it are pretty basic so it wasn't worth it to update the common infrastructure.
b238105
to
2721367
Compare
: files.join('\n'); | ||
|
||
return ( | ||
`Cannot update to Angular Material v17, because the project is using the legacy ` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove the commas before "because" (and in the next sentence)
…ponents These changes add a schematic that will log a fatal error and prevent the app from updating to v17 if it's using legacy components. Legacy components have been deleted in v17 so the app won't build if it updates.
2721367
to
3c49fd1
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
These changes add a schematic that will log a fatal error and prevent the app from updating to v17 if it's using legacy components. Legacy components have been deleted in v17 so the app won't build if it updates.
Updating to Material v17 using
ng update
will look like this: